package com.zjmzxfzhl.modules.app.form;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zjmzxfzhl.common.core.validator.constraints.LengthForUtf8;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 *   提醒设置
 * Created by macro on 2018/5/17.
 */
@Data
public class MeetTaskVo {
    /**
     * ID
     */
    @TableId
//    @NotNull
    @LengthForUtf8(max = 32)
    private String taskId;

    /**
     * 任务名称
     */
    @NotNull
    @LengthForUtf8(max = 100)
    private String name;

    /**
     * 上级机构ID
     */
    @LengthForUtf8(max = 32)
    private String parentTaskId;

    /**
     * 机构级次
     */
//    @NotNull
    @LengthForUtf8(max = 2)
    private String taskLevel;

    /**
     * 组织机构路径
     */
//    @NotNull
    @LengthForUtf8(max = 255)
    private String taskLevelCode;

    /**
     * 是否叶子节点
     */
    @LengthForUtf8(max = 1)
    private String isLeaf;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField(exist = false)
    @LengthForUtf8(max = 32)
    private String projId;

    private List<MeetTaskVo> children;

    public void addChildren(MeetTaskVo meetTaskVo) {
        if (this.children == null) {
            this.children = new ArrayList();
        }

        this.children.add(meetTaskVo);
    }
}
